export const VITE_PROXY = [
  ['/api', ' https://mock.presstime.cn/mock/67282170caf0b4e52f14102d/api'],
]

export function createViteProxy() {
  const res = {}
  VITE_PROXY.forEach(([prefix, target]) => {
    res[prefix] = {
      target,
      secure: false,
      changeOrigin: true,
      headers: {
        Referer: target,
      },
      rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
    }
  })
  return res
}
